package com.androidx.p013lv.invention.view;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.InventionBean;
import com.androidx.p013lv.base.bean.InventionThreeBean;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.listener.ItemClickListener;
import com.androidx.p013lv.base.p015ui.LazyFragment;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.invention.C1069R;
import com.androidx.p013lv.invention.OnInventionType;
import com.androidx.p013lv.invention.adapter.AdapterFourHead;
import com.androidx.p013lv.invention.adapter.AdapterThree;

/* renamed from: com.androidx.lv.invention.view.FourView */
public class FourView {
    AdapterThree adapter;
    AdapterFourHead adapterHead;
    LinearLayout btn_more;
    Context context;
    String domain;
    Fragment fragment;
    InventionBean inventionBean;
    ImageView iv_cover;
    OnInventionType onInventionType;
    int position;
    RecyclerView recycler;
    RecyclerView recyclerHead;
    TextView tv_address;
    TextView tv_include;
    TextView tv_name;
    TextView tv_title;

    public FourView(View view, Fragment fragment2, String str, OnInventionType onInventionType2) {
        this.context = view.getContext();
        this.onInventionType = onInventionType2;
        this.domain = str;
        this.fragment = fragment2;
        this.tv_title = (TextView) view.findViewById(C1069R.C1072id.tv_title);
        this.btn_more = (LinearLayout) view.findViewById(C1069R.C1072id.btn_more);
        this.tv_address = (TextView) view.findViewById(C1069R.C1072id.tv_address);
        this.tv_include = (TextView) view.findViewById(C1069R.C1072id.tv_include);
        this.tv_name = (TextView) view.findViewById(C1069R.C1072id.tv_name);
        this.iv_cover = (ImageView) view.findViewById(C1069R.C1072id.iv_cover);
        this.recyclerHead = (RecyclerView) view.findViewById(C1069R.C1072id.recycler_head);
        this.recycler = (RecyclerView) view.findViewById(C1069R.C1072id.recycler);
        ViewGroup.LayoutParams layoutParams = this.iv_cover.getLayoutParams();
        layoutParams.height = (int) ((double) ((UiUtils.getWindowWidth() * 19) / 21));
        this.iv_cover.setLayoutParams(layoutParams);
    }

    public void setView(InventionBean inventionBean2, int i) {
        this.inventionBean = inventionBean2;
        this.position = i;
        this.tv_title.setText(inventionBean2.getStationName());
        initData();
        this.btn_more.setOnClickListener(new View.OnClickListener() {
            /* class com.androidx.p013lv.invention.view.FourView.View$OnClickListenerC11641 */

            public void onClick(View view) {
                FourView.this.onInventionType.onClick(FourView.this.inventionBean, FourView.this.position, view.getId());
            }
        });
    }

    /* access modifiers changed from: package-private */
    public void initData() {
        this.adapterHead = new AdapterFourHead(this.fragment, this.domain, this.inventionBean.getContentList());
        this.recyclerHead.setLayoutManager(new LinearLayoutManager(this.context, 0, false));
        this.recyclerHead.setAdapter(this.adapterHead);
        if (this.inventionBean.getContentList().size() > 0) {
            setRecycler(this.inventionBean.getContentList().get(0));
        }
        this.adapterHead.setItemListener(new ItemClickListener() {
            /* class com.androidx.p013lv.invention.view.FourView.C11652 */

            @Override // com.androidx.p013lv.base.listener.ItemClickListener
            public void onItemClick(View view, int i) {
                if (!((LazyFragment) FourView.this.fragment).isOnClick()) {
                    FourView.this.adapterHead.setIndex(i);
                    FourView fourView = FourView.this;
                    fourView.setRecycler(fourView.inventionBean.getContentList().get(i));
                }
            }
        });
    }

    /* access modifiers changed from: package-private */
    public void setRecycler(final InventionThreeBean inventionThreeBean) {
        if (this.adapter == null) {
            this.adapter = new AdapterThree(this.fragment, this.domain);
            this.recycler.setLayoutManager(new LinearLayoutManager(this.context, 0, false));
            this.recycler.setAdapter(this.adapter);
            this.adapter.setItemListener(new ItemClickListener() {
                /* class com.androidx.p013lv.invention.view.FourView.C11663 */

                @Override // com.androidx.p013lv.base.listener.ItemClickListener
                public void onItemClick(View view, int i) {
                    if (!((LazyFragment) FourView.this.fragment).isOnClick()) {
                        ((LazyFragment) FourView.this.fragment).startVideoPlay(((VideoBean) FourView.this.adapter.getDataInPosition(i)).getVideoId());
                    }
                }
            });
        }
        this.adapter.setData(inventionThreeBean.getVideoList());
        this.tv_address.setText(inventionThreeBean.getInfo());
        TextView textView = this.tv_include;
        textView.setText(inventionThreeBean.getVideoNum() + "部");
        this.tv_include.getPaint().setFlags(8);
        this.tv_include.getPaint().setAntiAlias(true);
        this.tv_name.setText(inventionThreeBean.getContentName());
        Fragment fragment2 = this.fragment;
        GlideUtils.loadPicWh2(fragment2, this.domain + inventionThreeBean.getCoverImg(), this.iv_cover, 600);
        this.tv_include.setOnClickListener(new View.OnClickListener() {
            /* class com.androidx.p013lv.invention.view.FourView.View$OnClickListenerC11674 */

            public void onClick(View view) {
                if (!((LazyFragment) FourView.this.fragment).isOnClick()) {
                    ARouter.getInstance().build(Constance.STAR_INFO_ACTIVITY).withInt("type", inventionThreeBean.getContentId()).withString(Key.TXT, "發現").navigation();
                }
            }
        });
        this.iv_cover.setOnClickListener(new View.OnClickListener() {
            /* class com.androidx.p013lv.invention.view.FourView.View$OnClickListenerC11685 */

            public void onClick(View view) {
                if (!((LazyFragment) FourView.this.fragment).isOnClick()) {
                    ARouter.getInstance().build(Constance.STAR_INFO_ACTIVITY).withInt("type", inventionThreeBean.getContentId()).withString(Key.TXT, "發現").navigation();
                }
            }
        });
    }
}
